//{====================================================================================
//! @file Var2taskDotv.c
//! @date    2013-09-29 21:31
//! @author Andrianov Georgiy <egor.andrianov81@gmail.com>
//!
//! Programm calculate number of decomposition on not repeated numbers
//!
//! @par The programm enters number
//!      The programm outputs number of decomposition
//}====================================================================================

#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int decomposition(int a, int b);


int main()
{
    int n = 0, nDecomp = 0, i = 0, j = 0;
    printf("Input number\n");
    scanf("%i", &n);
    nDecomp = decomposition(n, n);
    printf("%i is a number of decomposition of %i", nDecomp, n);
    return 0;
}

//! decomposition - calculate number of decomposition number n on not repeated numbers
//!                 all of them smaller or equal then k
//!
//! @param      a   number
//! @param      k   number
//!
//! @return         number of decomposition


int decomposition(int a, int b)
{
    if (b <= 0)
    {
        return 0;
    }
    else
    {
        if ((a == 0) || (a == 1))
        {

            return 1;
        }
        else
        {
            if (a > 0)
            {
            return decomposition(a-b, b-1) + decomposition(a, b-1);
            }
            else
            {
                return 0;
            }
        }
    }
}
